#ifndef LUALEXER_H
#define LUALEXER_H

#include <Qsci/qscilexercustom.h>
#include "../lua_parser/TokenParser.h"
#include "../lua_parser/luastyle.h"
#include "../lua_parser/Token.h"
#include <QHash>

//Scite supports up to 32 styles
enum StyleTypeEnum
{
    EStyleDefault = 0,
    EStyleKeyword,
    EStyleError,
    EStyleLocal,
    EStyleGlobal,
    EStyleParam,
    EStyleNumber,
    EStyleComment,
    EStyleString,
    EStyleHyperlink,
    EStyleStandard,
    EStyleErrorAnnotation
};

class LuaLexer : public QsciLexerCustom
{
     Q_OBJECT
private:
    TokenParser * m_parser;
    QHash<StyleTypeEnum, LuaStyle *> m_styles;
    bool m_completeOverdraw;
    int m_hyperLinkStart;
    int m_hyperLinkLength;
public:
    explicit LuaLexer(QObject *parent = 0);
    ~LuaLexer();
    //SciLexer virtual functions
    const char * language() const;
    QColor defaultColor(int aStyle) const;
    QFont defaultFont(int aStyle) const;
    QColor defaultPaper(int aStyle) const;
    void styleText (int aStart, int aEnd);
    QString description (int aStyle) const;
    TokenParser * getParser() const;
    void setParser(TokenParser * aParser);
    int styleBitsNeeded() const;
    void highlightLink(int aStart, int aLength);
    void setCompleteOverdraw(bool aOverdraw);
    void setHyperlinkRange(int aStart, int aLength);
    void refreshStyles();
private:
    LuaLexer(const LuaLexer &);
    LuaLexer &operator=(const LuaLexer &);
};

#endif // LUALEXER_H
